package com.cqeec.demo2.demos.Controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestController {
    @RequestMapping("test")
    @ResponseBody
    public String test(@RequestParam(name = "name", defaultValue = "unKnow") String name,
                       @RequestParam(name = "pwd", defaultValue = "345") String pwd,
                       @RequestParam(name = "test", defaultValue = "9087") String test) {
        return "test" + name;
    }

    @RequestMapping("/test01/{id}")
    @ResponseBody
    public String hello(@PathVariable("name") String name) {
        return "hello" + name;
    }

    @RequestMapping("/toPage")
    public String toPage() {
        return "aaa/index.html";
    }
}